package net.qhzw.vip.qiyu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import net.qhzw.vip.qiyu.entity.DtsBatteryHistory;
import net.qhzw.vip.qiyu.entity.DtsBatteryManage;
import net.qhzw.vip.qiyu.entity.DtsBatteryStatus;
import net.qhzw.vip.qiyu.mapper.DtsBatteryHistoryMapper;
import net.qhzw.vip.qiyu.mapper.DtsBatteryManageMapper;
import net.qhzw.vip.qiyu.mapper.DtsBatteryStatusMapper;
import net.qhzw.vip.qiyu.model.DtsBatteryManageVo;
import net.qhzw.vip.qiyu.result.JsonResult;
import net.qhzw.vip.qiyu.service.DtsBatteryHistoryService;
import net.qhzw.vip.qiyu.service.DtsBatteryManageService;
import net.qhzw.vip.qiyu.service.DtsBatteryStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class DtsBatteryHistoryImpl extends ServiceImpl<DtsBatteryHistoryMapper, DtsBatteryHistory> implements DtsBatteryHistoryService {
         @Autowired
         private DtsBatteryHistoryMapper dtsBatteryHistoryMapper;
         @Autowired
         private DtsBatteryManageService dtsBatteryManageService;

    @Override
    public DtsBatteryManageVo selectHisAnddts(String batteryCode) {
        DtsBatteryManageVo res = dtsBatteryHistoryMapper.selectHisStatus(batteryCode);
        if (res == null) {
            return null;
        }
        DtsBatteryManageVo dtsBatteryManageVo = dtsBatteryHistoryMapper.selectHisStatusCi(res.getId());

        if (dtsBatteryManageVo == null){
            return res;
        }
          return dtsBatteryManageVo;

    }

    @Override
    public List<DtsBatteryHistory> selectListHisDetail(Long id) {
       return   dtsBatteryHistoryMapper.selectListHisDetail(id);

    }
}
